{
snprintf (d, n, "\t%s\n",
babl_get_name(fish->fish_path.conversion_list->items[i] ));
- n -= strlen (d);
- d += strlen (d);
+ n -= strlen (d);d += strlen (d);
}
}
break;
FILE *dbfile = fopen (fish_cache_path (), "w");
if (!dbfile)
return;
- fprintf (dbfile, "#%s\n", BABL_GIT_VERSION);
+ fprintf (dbfile, "#%s BABL_TOLERANCE=%f\n", BABL_GIT_VERSION, _babl_legal_error ());
/* sort the list of fishes by usage, making next run more efficient -
* and the data easier to approach as source of profiling
break;
case '#':
/* if babl has changed in git .. drop whole cache */
- if (strcmp ( &token[1], BABL_GIT_VERSION))
+ {
+ char buf[2048];
+ sprintf (buf, "#%s BABL_TOLERANCE=%f", BABL_GIT_VERSION, _babl_legal_error ());
+ if (strcmp ( token, buf))
{
free (contents);
return;
}
+ }
break;
case '\t':
if (strchr (token, '='))
}
else
{
- Babl *conv =
- (void*)babl_db_find(babl_conversion_db(), &token[1]);
+ Babl *conv = (void*)babl_db_find(babl_conversion_db(), &token[1]);
if (!conv)
{
return;
if (contents)
free (contents);
}
-
const Babl *destination,
int is_reference);
-static double legal_error (void);
static int max_path_length (void);
-static double legal_error (void)
+double _babl_legal_error (void)
{
static double error = 0.0;
const char *env;
path_error *= (1.0 + babl_conversion_error ((BablConversion *) pc->current_path->items[i]));
}
- if (path_error - 1.0 <= legal_error ()) /* check this before the next;
- which does a more accurate
- measurement of the error */
+ if (path_error - 1.0 <= _babl_legal_error ())
+ /* check this before the more accurate measurement of error -
+ to bail earlier */
{
FishPathInstrumentation fpi;
memset (&fpi, 0, sizeof (fpi));
if ((path_cost < ref_cost) && /* do not use paths that took longer to compute than reference */
(path_cost < pc->fish_path->fish_path.cost) &&
- (path_error <= legal_error ()))
+ (path_error <= _babl_legal_error ()))
{
/* We have found the best path so far,
* let's copy it into our new fish */
}
+double _babl_legal_error (void);
void babl_init_db (void);
void babl_store_db (void);